<?php
    if(isset($_SESSION['SecureLogin'])){
        $visiteur = $_SESSION['SecureLogin']['username'];
        $connexion = 'Déconnexion';
        $action = 'logout';
        $inscrire = '<img src="'.$this->host.'resources/icons/gestion.png" alt="gestions"/>Gestion';
    }
    else{
        $visiteur = 'Visiteur';
        $connexion = 'Connexion';
        $action = 'login';
        $inscrire = 'S\'inscrire';
    }
    $linkInscrire = 'Admin/Index/create';

    $accueil = $facture = $admin = '';
    
    switch ($this->MVC['module']) {
    case 'default':
        $accueil = 'active';
        break;
    case 'Invoice':
        $facture = 'active';
        break;
    case 'Admin':
        $admin = 'active';
        break;
    default:
        break;
}
?>

<div class="navbar navbar-inverse navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container-fluid">
            <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </a>

            <a class="brand" href="<?php
echo $this->url(
        array('controller' => 'Home', 'action' => 'index'), 'default', true)
?>">XML Parser Collection</a>

            <div class="nav-collapse collapse" style="height: 0px; ">
                <p class="navbar-text pull-right">
                    <?php echo $visiteur ?> - <a href="<?php
               echo $this->url(
                       array('controller' => 'Index', 'action' => $action, 'module' => "Admin"), 'default', true)
?>" class="navbar-link"><?php echo $connexion ?></a>
                </p>
                <ul class="nav">
                    <li class="<?php echo $accueil ?>"><a href="<?php
                                    echo $this->url(
                                            array('controller' => 'Home', 'action' => 'index'), 'default', true)
?>">Accueil</a></li>
                    <li class="<?php echo $facture ?>"><a href="<?php
                                          echo $this->url(
                                                  array('controller' => 'Index', 'action' => 'index', 'module' => 'Invoice'), 'default', true)
?>">Mes Factures</a></li>
                    <?php if(isset($_SESSION['SecureLogin'])) : ?>
                        <?php if ("admin" == $_SESSION['SecureLogin']['role']) :?>
                        <li class="<?php echo $admin ?>"><a href="<?php
                                              echo $this->url(
                                                      array('controller' => 'Index', 'action' => 'index', 'module' => "Admin"), 'default', true)
    ?>">Administrateur</a></li>
                        <?php endif; ?>
                    <?php endif; ?>
                </ul>
            </div>
        </div>
    </div>
</div>